//
//  SHRuntimeModelViewController.m
//  SDemo
//
//  Created by gg on 2018/7/18.
//  Copyright © 2018年 gg. All rights reserved.
//

#import "SHRuntimeModelViewController.h"
#import <objc/message.h>
#import "NSObject+SHModel.h"
#import "SHStatus1Model.h"
#import "SHStatus2Model.h"
#import "SHStatus3Model.h"
@interface SHRuntimeModelViewController ()

@end

@implementation SHRuntimeModelViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"模型转数组";
    self.view.backgroundColor = [UIColor whiteColor];
    [self initData];
    
}

-(void)initData {
    SHStatus1Model *model1 = [SHStatus1Model modelChangeDic:[self parsingWithFile:@"status1.plist"]];
    NSLog(@"model1 : %@",model1);
    
    SHStatus2Model *model2 = [SHStatus2Model model2ChangeDic:[self parsingWithFile:@"status2.plist"]];
    NSLog(@"model2 : %@ user : %@",model2.source,model2.user.name);
    
    SHStatus3Model *model3 = [SHStatus3Model model3ChangeDic:[self parsingWithFile:@"status3.plist"]];
    NSLog(@"model3 ： %@",model3);
    
}


- (NSDictionary *)parsingWithFile:(NSString *)str{
    // 解析Plist文件
    NSString *filePath = [[NSBundle mainBundle] pathForResource:str ofType:nil];
    NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:filePath];
    
    return dict;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
